<?php

class Application_Model_Taobaoapi extends Application_Model_DomainObject {


	protected  $_id;

	protected $_taobaoname;

	protected $_api;

	protected $_freshtoken;

	protected $_sessionkey;
        
        protected $_taobaoSign;


        public static function byapitoken($api,$taobaoneme)
        {
            $where[" api = "] = $api;
            $where[" and taobaoname = "] = $taobaoneme;
            return Application_Model_Taobaoapi::getDao()->queryOne($where);
        }
	public static function getFilter($name,$pagesize,$pageindex)
        {
            $where = array();
            if($name != "")
            {
                $where["taobaoname like "] = "%".$name."%";
            }
            return Application_Model_Taobaoapi::getDao()->queryPage($where, "id desc", $pagesize, $pageindex);
        }
        
        public static function bytaobaoneme($taobaoname)
        {
            $where[" taobaoname = "] = $taobaoname;
            return Application_Model_Taobaoapi::getDao()->queryOne($where);
        }
        
        public static function byUserAll()
        {
            return self::getDao()->queryAll(array());
        }
        
        public static function getByTaoBaoSign($taobaoSign)
        {
            return self::getDao()->queryOne(array("taobaoSign"=>$taobaoSign));
        }
        
        public static function getSignAll()
        {
            $apiItem = self::byUserAll();
            $arrSign = array();
            foreach ($apiItem as $apiVal) {
                $arrSign[] = $apiVal->taobaoSign;
            }
            return $arrSign;
        }
}